﻿using System;
using System.Runtime.Serialization;
using System.Collections.ObjectModel;
using System.Collections.Generic;

namespace Reviewer.Entities
{
    [DataContract(Namespace = "Reviewer.Entities")]
    public sealed class ReviewSearchResult : Review, IExtensibleDataObject
    {
        public static bool operator ==(ReviewSearchResult item1, ReviewSearchResult item2)
        {
            // If both are null, or both are same instance, return true.
            if (System.Object.ReferenceEquals(item1, item2))
            {
                return true;
            }

            // If one is null, but not both, return false.
            if (((object)item1 == null) || ((object)item2 == null))
            {
                return false;
            }

            return item1.Equals(item2);
        }
        public static bool operator !=(ReviewSearchResult item1, ReviewSearchResult item2)
        {
            return !(item1 == item2);
        }

        [DataMember]
        public Guid GameGameId { get; set; }
        [DataMember]
        public string GameTitle { get; set; }
        [DataMember]
        public int GameFormat { get; set; }
        [DataMember]
        public string GameFormatName { get; set; }
        [DataMember]
        public int GameGenre { get; set; }
        [DataMember]
        public string GameGenreName { get; set; }

        public override bool Equals(object obj)
        {
            ReviewSearchResult second = obj as ReviewSearchResult;
            if (second != null)
            {
                return this.GameGameId.Equals(second.GameGameId)
                    && this.GameTitle.Equals(second.GameTitle)
                    && this.GameFormat.Equals(second.GameFormat)
                    && this.GameFormatName.Equals(second.GameFormatName)
                    && this.GameGenre.Equals(second.GameGenre)
                    && this.GameGenreName.Equals(second.GameGenreName)
                    && base.Equals(obj);
            }

            return false;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        #region IExtensibleDataObject Members
        ExtensionDataObject IExtensibleDataObject.ExtensionData { get; set; }
        #endregion
    }
}
